function get_links($typeVar, divID, $tags, $user, $and, $search) {

    $.ajax(
        {
            url: 'api/link/list.php',
            dataType: 'json',
            data: {
                type: $typeVar,
                tag: $tags,
                user: $user,
                and: $and,
                xml: '0'
            },
            success: function (data) {
                if ($search == '1', jQuery.isEmptyObject(data))
                    $('ul#' + divID).append('<li> No results, try searching again </li>');

                console.log(data);
                $.each(data, function (i) {
                    $('ul#' + divID).append('<div class="index">' + i + '</div>');
                     $('ul#' + divID).append('<a  href=' + data[i].linkValue + '>' + data[i].description );
                    
                   
                    $.each(data[i].tags, function (j) {
                        $('ul#' + divID).append(' <div class="tag">' + data[i].tags[j].name + ' </div>');
                    });

                    $('ul#' + divID).append('</a>  '+ ' <br>');
                });
                $('div.list-wrap').css('height', 'auto');
            },
            error: function (data) {
                if ($search == '1')
                    $('ul' + divID).append('<li> Error searching! </li>');
                console.log(data);
                alert('Error');
            }
        });

    }

function hasLink($user, $linkID) {
    $.ajax(
        {
            url: 'api/link/hasLink.php',
            dataType: 'json',
            data: {
                user: $user,
                link: $linkID,
                xml: '0'
            },
            success: function (data) {
                console.log(data);
                if (data == 1) {
                    return true;
                }
                else
                    return false;
            },
            error: function () {
                return false;
            }
        });
}